CentOS 安装 Docker, Compose, Machine, Swarm

安装 Docker

1
2
3
4
5
6
7
8
9
10
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce

docker version

sudo usermod -aG docker $(whoami)
sudo systemctl enable docker.service
sudo systemctl start docker.service
sudo systemctl status docker.service

参考文档: https://docs.docker.com/install/linux/docker-ce/centos/

安装 Compose

1
2
3
4
5
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

docker-compose version

参考文档: https://docs.docker.com/compose/install/

安装 Machine

1
2
3
4
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine

参考文档: https://docs.docker.com/machine/install-machine/

安装 Swarm

Docker 1.12+ 已经内部集成了 Swarm.

如果是 1.12- 版本, 可以参考 Swarm 独立运行版 进行安装.

Donate - Support to make this site better.
捐助 - 支持我让我做得更好.